package vip.xiaonuo.biz.modular.third.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.json.JSONUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.biz.modular.third.remote.TestClient;
import vip.xiaonuo.common.pojo.CommonResult;

import javax.annotation.Resource;

/**
 * 测试controller
 *
 * @author 叶伟
 * @date 2023/7/24 17:55
 */
@Api(tags = "测试controller")
@ApiSupport(author = "yewei", order = 1)
@RestController
@Validated
public class TestController {

    @Resource
    private TestClient testClient;

    /**
     * 获取天气状况
     *
     * @author 叶伟
     * @date 2023/7/24 18:00
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation("获取天气状况")
    @SaCheckPermission("/third/getWeather")
    @GetMapping("/third/getWeather")
    public CommonResult getTest(@RequestParam String city) {
        return CommonResult.data(JSONUtil.parseObj(testClient.getWeather(city)));
    }

}
